﻿using System.Web.Mvc;

namespace Songhay.Web.BiggestBox.ModelContext
{
    using Mvc.Extensions;
    using Songhay.Web.Mvc.Models;

    /// <summary>
    /// Silverlight Model Context
    /// </summary>
    public static class SilverlightModelContext
    {
        /// <summary>
        /// Gets the <see cref="SilverlightModel"/>.
        /// </summary>
        public static SilverlightModel GetModel(UrlHelper url)
        {
            var model = new SilverlightModel();

            model.BackgroundColor = "#e0eee0";

            model.EnableHtmlAccess = true;

            model.Source = string.Concat(url.BaseUriPath("/Content/"), "Silverlight/Songhay.Silverlight.ApplicationLoader.xap");

            model.ClientApplicationProperties.Add("config", "AppProperties");
            model.ClientApplicationProperties.Add("UriOpmlIndex", string.Concat(url.BaseUriPath("/Models/"), "SilvelightBiggestBoxIndex.xml"));
            model.ClientApplicationProperties.Add("UriJsonHeader", url.BaseUriPath("/Client/HeaderDisplayData"));

            model.InitializationParametersDictionary.Add("config", "AppProperties");
            model.InitializationParametersDictionary.Add("LoaderInfoXapPath", "Songhay.Silverlight.BiggestBox.xap");
            model.InitializationParametersDictionary.Add("LoaderInfoXapAssemblyName", "Songhay.Silverlight.BiggestBox.dll");
            model.InitializationParametersDictionary.Add("LoaderInfoXapAssemblyCompositionHost", "Songhay.Silverlight.BiggestBox.BiggestBoxCompositionHost");

            model.InitializationParametersDictionary.Add("BiggestBoxIndexXapPath", "Songhay.Silverlight.BiggestBox.IndexPart.xap");
            model.InitializationParametersDictionary.Add("BiggestBoxAdditionalSamplesXapPath", "Songhay.Silverlight.BiggestBox.AdditionalSamplesPart.xap");

            model.MinimumRuntimeVersion = "4.0.50401.0";
            model.RuntimeVersion = model.MinimumRuntimeVersion;

            return model;
        }
    }
}